package com.java.collection;

import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Set;
import java.util.TreeSet;

public class HashSetDemo {

    public static void main(String[] args) {
//        Set<String> set = new HashSet<>();
//        Set<String> set = new TreeSet<>();
        Set<String> set = new LinkedHashSet<>();
        set.add("alice");
        set.add("micheal");
        set.add("jerry");
        set.add("lucy");
        set.add("black");
//        set.remove("李四");
        System.out.println("数据个数：" + set.size());
        for(String s : set){
            System.out.println(s);
        }
        System.out.println("数据是否存在：" + set.contains("张三"));
        System.out.println("集合是否为空：" + set.isEmpty());
    }
}
